package pack

import (
	"mall_admin_api/biz/model"
	"mall_admin_api/biz/model/admin_orders_log"
)

func GetOrderLogList(list []*model.OrdersLog) []*admin_orders_log.OrderLog {
	var data = make([]*admin_orders_log.OrderLog, 0)
	if len(list) == 0 {
		return data
	}
	for _, category := range list {
		if category != nil {
			data = append(data, OrderLog(category))
		}
	}
	return data
}

func OrderLog(data *model.OrdersLog) *admin_orders_log.OrderLog {
	var info = &admin_orders_log.OrderLog{}
	if data == nil {
		return info
	}
	info.ID = data.ID
	info.OrderID = data.OrderID
	info.CreateBy = data.CreatedBy
	info.Remark = data.Remark
	if !data.CreatedAt.IsZero() {
		info.CreateTime = data.CreatedAt.UnixMilli()
	}

	return info
}
